/**
 * Copyright (C) 2011 The Android Open Source Project 
 * Emial : guoyil199@163.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */
package com;

/**
 * @author THINK
 * @Email guoyil199@163.com
 * @version V1.0
 * @Date 2016年5月27日 下午2:10:10
 * @Title <B>todo</B>
 * 
 * <pre>
 * 1、父类方法如果是静态方法，子类不能覆盖为非静态方法；
 * 
 * 2、父类方法如果是非静态方法，子类不能覆盖为静态方法；
 * 
 * 3、父类静态方法可以被覆盖，允许在子类中定义同名的静态方法，但是没有多态。
 * </pre>
 */

public class TestStaticExtend {

	/**
	 * <pre>
	 * todo
	 * </pre>
	 * 
	 * @param args
	 * @return void
	 */

	public static void main(String[] args) {
		 Demo d = new Demo();
		 d.display();
		 d = new DemoTest();// 注意观察这条语句的输出，是输出hello还是nihao
		 d.display();

		DemoTest.display();
		Demo.display();

	}

}

class Demo {
	public static void display() {
		System.out.println("hello");
	}
}

class DemoTest extends Demo {
	public static void display() {
		System.out.println("nihao");
	}
}
